//
//  BaseWkwebviewVC.h
//  jhf
//
//  Created by 计海峰 on 2017/11/23 14:05:37.
//  Copyright © 2017年 计海峰. All rights reserved.
//

#import "JHF_BaseVC.h"
#import <UIKit/UIKit.h>
#import <WebKit/WebKit.h>

typedef void(^WebReponse)(bool,id);

@interface BaseWkwebviewVC : JHF_BaseVC

//url 参数
@property (nonatomic,strong) NSDictionary *body;

//请求
@property (nonatomic,strong) NSMutableURLRequest *request;

//webView
@property (strong, nonatomic) WKWebView *webView;

//是否需要空显示 默认NO
@property (nonatomic,assign) BOOL emptyData;

//是否需要处理JS 默认NO
@property (nonatomic,assign) BOOL dealJS;

//是否需要获取图片 默认NO
@property (nonatomic,assign) BOOL needImages;

//是否需要断网刷新 需要开启AF网络监听 默认NO
@property (nonatomic,assign) BOOL needNetMonit;

//是否post提交
@property (nonatomic,assign) BOOL isPost;

//webview frame
@property (nonatomic,assign) UIEdgeInsets padding;

//进度条颜色 
@property (nonatomic, assign) BOOL needProgress;

@property (nonatomic, strong) UIColor *tintColor;

@property (nonatomic, strong) UIColor *trackTintColor;

/**
 * 刷新网页
 */
- (void)refreshWebView;

/**
 *  加载本地的HTML文件
 *
 *  @param htmlFileName HTML文件的名称
 *
 *  @return 实体
 */
- (instancetype)initWithLocalName:(NSString *)htmlFileName;

/**
 *  网页初始化
 *
 *  @param urlString 基本的请求地址
 *  @param body      参数
 *
 *  @return 实体
 */
- (instancetype)initWithUrlString:(NSString *)urlString withBody:(NSDictionary *)body ;

/**
 是否进行跳转

 @param webView webview
 @param navigationAction navigationAction
 @param decisionHandler 回调是否允许
 */
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler;

/**
 网页加载完成 复写必须super
 
 @param webView webview
 @param navigation navigation
 */
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation;


#pragma mark 🔩 公开方法

/**
 通过js获取htlm中图片url
 
 @param wkWebView wkWebView
 @return 图片地址数组
 */
+ (NSArray *)getImageUrlByJS:(WKWebView *)wkWebView;

@end
